{% extends 'admin_base.html' %}
{% load static %}
{% load i18n %}
{% load crispy_forms_tags %}

{% block actions %}
  {% if object %}
    <form method="POST" action="{% url 'templates:duplicate' object.class_name object.id %}">
      {% csrf_token %}
      <button type="submit" class="btn btn-primary">
        {% translate "Duplicate" %}
      </button>
    </form>
    <form method="POST" action="{{ object.delete_url }}">
      {% csrf_token %}
      <button type="submit" class="btn btn-danger">
        {% translate "Delete" %}
      </button>
    </form>
  {% endif %}
{% endblock %}
{% block content %}
<div class="row">
  <div class="col-12">
    <form method="POST">
      <div class="card">
        <div class="card-body">
          {% crispy form %}
          <div class="form-footer">
            <button type="submit" class="btn btn-primary">{% if object %}{% translate "Update" %}{% else %}{% translate "Create" %}{% endif %}</button>
          </div>
        </div>
      </div>
    </form>
  </div>
</div>
{% endblock %}
{% block extra_js %}
{% if DEBUG %}
<script src="{% static 'js/vue.js' %}"></script>
{% else %}
<script src="{% static 'js/vue.min.js' %}"></script>
{% endif %}
<script>
var placeholder = '{% translate "Start typing here..." %}';
var newItemText = '{% translate "New item" %}';
</script>
<script src="{% static 'js/resources.js' %}"></script>
<script>
  initResource()
</script>
{% endblock %}
